// 1. 初始化
const pointDistWrapper = document.querySelector('.dist-wrapper .chart');
const pointDistChart = echarts.init(pointDistWrapper);
// 2. 配置项
const pointDistOption = {
    tooltip: {
        trigger: 'item'
    },
    visualMap: {
        show: false,
        min: Math.min(...pointDistribution.map(item => item.value)), // 999
        max: Math.max(...pointDistribution.map(item => item.value)), // 1322
        inRange: {
            colorLightness: [.3, .7]
        }
    },
    series: [
        {
            type: 'pie',
            radius: '55%',
            center: ['50%', '50%'],
            data: pointDistribution
                .map(item => ({ name: item.city, value: item.value }))
                .sort((a, b) => a.value - b.value),
            roseType: 'radius',
            // 标签
            label: {
                color: 'rgba(255, 255, 255, .7)'
            },
            // 标签线
            labelLine: {
                lineStyle: {
                    color: 'rgba(255, 255, 255, .3)'
                },
                smooth: 0.2,
                length: 10,
                length2: 20
            },
            // 图表项
            itemStyle: {
                color: 'yellow',
                // shadowBlur: 50,
                // shadowColor: 'rgba(255, 0, 0, 0.5)'
            },
            animationType: 'scale',
            animationEasing: 'elasticOut',
            animationDelay: function (idx) {
                return Math.random() * 200;
            }
        }
    ]
};
// 3. 导入配置项
pointDistChart.setOption(pointDistOption);
